import React, { Component } from 'react'

export default class NotControlForm extends Component {

    username =  React.createRef()
    password = React.createRef()
  render() {
    return (
      <div>
        <h2>登录</h2>
        <hr />
        <form action="">
            用户名:<input ref={this.username} type="text" />
            登录:<input ref={this.password} type="password"></input>
            <button onClick={this.login}>登录</button>
        </form>
      </div>
    )
  }
  login = (e)=>{
    e.preventDefault()
    let user = this.username.current.value
    let pass = this.password.current.value
    console.log(`用户名为${user},密码为${pass}`);
  }
}
